package com.ccb.lms.action;

import java.util.ArrayList;

import com.ccb.lms.dto.ReaderBorrowHistoryDto;
import com.ccb.lms.facade.FacadeService;
import com.ccb.lms.model.Reader;

@SuppressWarnings("serial")
public class ReaderAction3 extends AbstractAction{
	
	private FacadeService facadeService;
	private Reader reader;
	private ArrayList<ReaderBorrowHistoryDto> readerBorrowHistoryDtos;
	
	@Override
	public String execute() throws Exception {
		
		return super.execute();
	}
	
	public String returnBorrowHistory(){
		reader = (Reader)session.get("reader");
		if(reader == null){
			return INPUT;
		}
		try{
			readerBorrowHistoryDtos = facadeService.getReaderService().getReaderBorrowHistoryDtosByreaderNO(reader.getReaderNO());
		} catch (Exception e) {
			return ERROR;
		}
		return SUCCESS;
	}
	public FacadeService getFacadeService() {
		return facadeService;
	}

	public void setFacadeService(FacadeService facadeService) {
		this.facadeService = facadeService;
	}

	public ArrayList<ReaderBorrowHistoryDto> getReaderBorrowHistoryDtos() {
		return readerBorrowHistoryDtos;
	}

	public void setReaderBorrowHistoryDtos(ArrayList<ReaderBorrowHistoryDto> readerBorrowHistoryDtos) {
		this.readerBorrowHistoryDtos = readerBorrowHistoryDtos;
	}
	
}
